<?php
/**
 * Created by JetBrains PhpStorm.
 * File: RoleModel.class.php
 * User: Xnfy520@gmail.com
 * Date: 12-3-12
 * Time: 下午2:39
 */

	class SectionModel extends RelationModel{

		protected $_link = array(
			'Category'=>array(
				'mapping_type'=>HAS_MANY,
				'mapping_name'=>'category',
				'class_name'=>'Category',
				'foreign_key'=>'sectionid',
			),
			'Article'=>array(
				'mapping_type'=>HAS_MANY,
				'mapping_name'=>'article',
				'class_name'=>'Article',
				'foreign_key'=>'sectionid',
			),
		);


		protected $_validate = array(

			array('name', 'require', '单元名不能为空', 1),
			array('sort', 'number', '排序必须为数字', 1),
		//	array('name', '2, 7', '分组名长度不能少于2位, 大于7位', 1, 'length'),

		);

		protected $_auto = array(

			array('created', 'time',1 , 'function'),
			array('modified', 'time', 3, 'function'),

		);

	}